﻿using System.Collections.Generic;

namespace Dpx.Models {
    /// <summary>
    /// 条件类型
    /// </summary>
    public class FilterType {
        
        /// <summary>
        /// 类型名。
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// 属性名。
        /// </summary>
        public string PropertyName { get; }

        /// <summary>
        /// 标题条件。
        /// </summary>
        public static readonly FilterType NameFilter =
            new FilterType("标题", nameof(Poetry.Name));

        /// <summary>
        /// 作者条件。
        /// </summary>
        public static readonly FilterType AuthorNameFilter =
            new FilterType("作者", nameof(Poetry.AuthorName));

        /// <summary>
        /// 内容条件。
        /// </summary>
        public static readonly FilterType ContentFilter =
            new FilterType("内容", nameof(Poetry.Content));

        /// <summary>
        /// 条件类型数组。
        /// </summary>
        public static List<FilterType> FilterTypes { get; } =
            new List<FilterType> { NameFilter, AuthorNameFilter, ContentFilter };

        // *********** 构造函数

        /// <summary>
        /// 条件类型。
        /// </summary>
        /// <param name="name">类型名。</param>
        /// <param name="propertyName">属性名。</param>
        private FilterType(string name, string propertyName) {
            Name = name;
            PropertyName = propertyName;
        }
    }
}